package com.whmskj.xjlhsc.schedul.async.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.whmskj.xjlhsc.schedul.async.mapper.DbClsPowerStatisticsMapper;
import com.whmskj.xjlhsc.schedul.async.po.DbClsPowerStatistics;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

/**
 * @BelongsProject: XJLHSC
 * @BelongsPackage: com.whmskj.xjlhsc.schedul.async.service
 * @Author: lk
 * @CreateTime: 2025-07-01
 * @Description: TODO
 * @Version: 1.0
 */
@Service
public class DbClsPowerStatisticsService extends ServiceImpl<DbClsPowerStatisticsMapper, DbClsPowerStatistics> {
    public List<DbClsPowerStatistics> listByRangeWithDbId(int day, Integer dbId) {
        LocalDate endDate = LocalDate.now();
        LocalDate startDate = endDate.minusDays(day);

        return baseMapper.listByRangeWithDbId(startDate.toString(), endDate.toString(), dbId);
    }
}
